import React, {Component} from 'react'
import {StyleSheet, View, Text, TouchableOpacity} from 'react-native'

const styles = StyleSheet.create({
    view: {
        flex: 1,
        justifyContent: 'center',
        alignItems: 'center',
        height: 16
    },
    text: {
        lineHeight: 16,
        // fontSize: 16,
        height: 16,
        color: 'black',
        textAlign: 'center'
    }
})

class TouchableText extends Component {
    pressHandle(id) {
        console.log('去公告详情的id:',id)
    }
    render() {
        const {announcementId,announcementName} = this.props.announcement;
        return <TouchableOpacity
            style={styles.view}
            onPress={() => this.pressHandle(announcementId)}>
            <View style={styles.view}>
                <Text 
                ellipsizeMode={'tail'}
                numberOfLines={1} 
                style={styles.text}>{announcementName}</Text>
            </View>
        </TouchableOpacity>
    }
}

export default TouchableText